package test.test.one.objects.tools;

/**
 * This class is used to give world objects speed, and ergo the ability of moving
 *
 */
public class Speed {
	
	//Defining moving directions
	public static final int DIRECTION_RIGHT	= 1;
	public static final int DIRECTION_LEFT	= -1;
	public static final int DIRECTION_UP	= -1;
	public static final int DIRECTION_DOWN	= 1;
	
	//Defining default x-y directions
	private int xDirection = DIRECTION_RIGHT;
	private int yDirection = DIRECTION_UP;
	
	//Declaring x-y velocity
	private float xv, yv;
	
	/**
	 * Basic class constructor
	 * An object with this Speed wont move
	 */
	public Speed() {
		this.xv = 0;
		this.yv = 0;
	}
	
	/**
	 * Alternative class constructor
	 * 
	 * @param xv, x-axis velocity
	 * @param yv, y-axis velocity
	 */
	public Speed(float xv, float yv) {
		this.xv = xv;
		this.yv = yv;
	}

	/*
	 * set & get
	 */
	
	public float getXv() {
		return xv;
	}
	public void setXv(float xv) {
		this.xv = xv;
	}
	public float getYv() {
		return yv;
	}
	public void setYv(float yv) {
		this.yv = yv;
	}
	public int getxDirection() {
		return xDirection;
	}
	public void setxDirection(int xDirection) {
		this.xDirection = xDirection;
	}
	public int getyDirection() {
		return yDirection;
	}
	public void setyDirection(int yDirection) {
		this.yDirection = yDirection;
	}

	/*
	 * class methods
	 */
	
	/**
	 * inverts the direction on the x-axis
	 */
	public void toggleXDirection() {
		xDirection = xDirection * -1;
	}
	
	/**
	 * inverts the direction on the y-axis
	 */
	public void toggleYDirection() {
		yDirection = yDirection * -1;
	}

}
